%include
:- lib(ic), lib(listut).

testSumSum(Path, OState, Arg, Result, NState) :-
	Path > 0,
	% Domains
	[N] :: -127 .. 128,
	[NN] :: -127 .. 128,
	[M] :: -127 .. 128,
	[NM] :: -127 .. 128,
	% Constraints
	Arg = [N, M],
	NState = [NN, NM],
	sumSum(Path, OState, Arg, Result, NState),
	% Solving
	indomain(N),
	indomain(NN),
	indomain(M),
	indomain(NM).

sumSum(1, [], [N, M], [], [NStart, NEnd]) :-
	% Precondition
	First #=< Last,
	% Postcondition
	NStart #= First,
	NEnd #= Last,
	% Invariant
	NStart #=< NEnd.

